home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1998 September
/
EnigmA AMIGA RUN 30 (1998)(G.R. Edizioni)(IT)[!][issue 1998-09].iso
/
earkit
/
news
/
thor
/
scripts
/
bbbs.ncomm.script
< prev
next >
Wrap
Text File
|
1998-07-09
|
8KB
|
425 lines
; $VER: BBBS.NComm.script 4.1 (8.8.95)
; BBBS NComm Script for THOR
; By Eivind Nordseth, Ultima Thule Software
REQUEST OFF
set $fixtimeout = ""
set $rengrab = ""
set $doctrlx = "FALSE"
set $done = "FALSE"
cli $THORPath"bin/ScriptServ \""$BBSName"\" WRITECFG EV 7 EV 8 EV 11 EV 12"
if exists "t:NoLogOut" then cli "delete >nil: t:NoLogOut"
if exists "t:DoLogOut" then cli "delete >nil: t:DoLogOut"
varfile "t:"$BBSName".CONFIG"
readvar $CfgVer
readvar $BBSID
readvar $BBSType
readvar $Path
readvar $PostConf
readvar $UpLoadDir
readvar $UserName
readvar $UserStreet
readvar $UserAddress
readvar $UserCountry
readvar $UserPhone
readvar $NewFiles
readvar $AutoPDnl
readvar $AutoLogoff
readvar $UseColors
readvar $AnsiMenues
readvar $Bulletins
readvar $ReplyPacket
varfile close
if !$CfgVer == "4" then message "Incompatible version of ScriptServ"
if !$CfgVer == "4" then goto AllDone
if $ReplyPacket == "" then set $ReplyPacket = $BBSID".REP"
cli "delete >nil: \"t:"$BBSName".CONFIG\""
set $LogFile = $Path"ScriptMsg.txt"
when "\r\nNO CARRIER\r\n" goto AllDone
autoxfer off ; Turn off G&R commands
autoup off ; Turn off Zmodem autoupload
autodown on ; Turn on Zmodem autodownload
menuselect TRANSLATE 1 8 ; Use IBN character set
set $charset = "IBN" ; Use IBN character set
converse "FIRST name?" $UserName" Q\n"
converse "will echo):" "\p\n"
when "--more--" send "C"
when "Trykk <enter>" send "\n"
set $docmd = "CHAT N U L 0 MF 50 S IBN\n"
gosub DoCommand
dwhen "Trykk <enter>"
wait "Command"
set $doctrlx = "TRUE"
if !exists "t:"$BBSName".EVENTS" then goto afterEvents
varfile "t:"$BBSName".EVENTS"
eventLoop:
set $done = "FALSE"
readvar $eventnr
readvar $event
if $eventnr == "EOF" then goto evLoopEnd
if $event == "EOF" then goto evLoopEnd
if $event == "7" then gosub ConfigureBBS
if $event == "8" then gosub SendUserInfo
if $event == "11" then gosub CommandEvent
if $event == "12" then gosub AutoLogOff
if $done == "TRUE" then cli "run >nil: "$THORPath"bin/ScriptServ \""$BBSName"\" DONE "$eventnr
if !$done == "TRUE" then cli "run >nil: "$THORPath"bin/ScriptServ \""$BBSName"\" ERROR "$eventnr
goto eventLoop
evLoopEnd:
varfile close
afterEvents:
;***************** Set correct grab format
set $docmd = "U GF H\n"
gosub DoCommand
;***************** Send reply packet
if !exists $UpLoadDir$ReplyPacket then goto AfterReplyPacket
set $docmd = "Q MU\n"
gosub DoCommand
set $reperr = "FALSE"
when "Hippo fatal error:" set $reperr = "TRUE"
wait "Starting ZModem"
upload $UpLoadDir$ReplyPacket,Z
gosub NoTimeout
capture $Path"HIPPOMsg.txt"
wait "Main Command"
capture off
dlwhen
if $reperr == "TRUE" then goto RepFileFail
cli "delete >nil: "$UpLoadDir$ReplyPacket
cli "delete >nil: "$Path"HIPPOMsg.txt"
cli "run >nil: "$THORPath"bin/ScriptServ \""$BBSName"\" PACKAGEDONE"
set $doctrlx = "TRUE"
goto AfterReplyPacket
RepFileFail:
set $appendsource = $Path"HIPPOMsg.txt"
set $appenddest = $LogFile
gosub AppendFile
set $doctrlx = "TRUE"
AfterReplyPacket:
;***************** Grab messages
set $rengrab = "y"
set $docmd = "R DUMP ALL\n"
gosub DoCommand
when "<0>" goto grabd
converse "Command" "SE\n"
gosub NoTimeout
set $rengrab = "y"
grabd:
dlwhen
;***************** Ready for logout
if exists "t:DoLogOut" then goto DoLogOut
if $AutoLogoff == "n" then goto NoLogOut
if exists "t:NoLogOut" then goto NoLogOut
DoLogOut:
set $docmd = "CHAT A U L 30 MF 0\n"
gosub DoCommand
set $docmd = "G Y N Y\n"
gosub DoCommand
when "\r\nNO CARRIER\r\n" goto Hanged
delay 2
repeat
hangup
delay 2
until !CARRIER
Hanged:
dlwhen
goto AllDone
NoLogOut:
set $docmd = "CHAT A U L 30 MF 0 W R\n"
gosub DoCommand
dwhens
timeout 0
AllDone:
request on
end
Hung:
beep
message "\nI think the board has hung."
message "\nTurn off this script within 20 seconds to stop me from logging out !!"
delay 20
beep
message "\nWARNING: Logout in progress.\n"
hangup
goto AllDone
SysOp:
send "Sorry, you are trying to chat with a script.\n"
send "Please put me back to the BBS at once.\n"
set $Timeouts = "0"
wait "SYSOP is going offline!"
set $Timeouts = "0"
return
;************************************************
DoCommand:
if $doctrlx == "TRUE" then send "^Z"
converse "Command" $docmd
if !$rengrab == "" then gosub RenameGrab
if !$fixtimeout == "" then gosub SetupTimeout
set $doctrlx = "FALSE"
return
;************************************************
NoTimeout:
set $fixtimeout = "d"
timeout 0
return
SetupTimeout:
set $fixtimeout = ""
set $Timeouts = "0"
timeout 60 gosub SendCTRLX
return
SendCTRLX:
set $fixtimeout = "d"
if $Timeouts == "2" then timeout 20 gosub Hung
if $Timeouts == "2" then send "^Z"
if $Timeouts == "1" then send $docmd
if $Timeouts == "1" then set $Timeouts = "2"
if $Timeouts == "0" then send "^Z"
if $Timeouts == "0" then set $Timeouts = "1"
return
Hung:
beep
message "\nI think the board has hung."
message "\nTurn off this script within 20 seconds to stop me from logging out !!"
delay 20
beep
message "\nWARNING: Logout in progress.\n"
hangup
goto AllDone
;************************************************
RenameGrab:
set $rengrab = ""
cli $THORPath"bin/ScriptServ \""$BBSName"\" RENAMEGRAB"
cli "run >nil: sys:rexxc/rx 'address THOR.01 RESCAN'"
return
;************************************************
Startlogfile:
if !exists $LogFile then write $LogFile "Messages from script:\n"
write $LogFile "Error in event nr "$eventnr":\n"
return
;************************************************
; Append a file to the en of the other.
; Uses variables:
; $appendsource - File to append.
; $appenddest - Destination.
AppendFile:
if !exists $appenddest then goto afNotExists
cli "join >nil: \""$appenddest"\" \""$appendsource"\" TO \""$appenddest".tmp\""
cli "delete >nil: \""$appenddest"\""
cli "rename >nil: \""$appenddest".tmp\" \""$appenddest"\""
cli "delete >nil: \""$appendsource"\""
return
afNotExists:
cli "rename >nil: \""$appendsource"\" \""$appenddest"\""
return
;************************************************
; Do a custom command
; Uses variables:
; $commandstring - Command to execute.
CommandEvent:
readvar $commandstring
write $LogFile "Executing custom command:\n"
set $docmd = $commandstring"\n"
gosub DoCommand
capture $LogFile
gosub NoTimeout
when "File Command" goto CmdEvDone
when "Main Command" goto CmdEvDone
when "Utility Command" goto CmdEvDone
when "SYSOP Command" goto CmdEvDone
when "SIGOP Command" goto CmdEvDone
when "Misc Command" goto CmdEvDone
wait "Read Command"
CmdEvDone:
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
dlwhen
capture off
write $LogFile "\n"
set $done = "TRUE"
set $doctrlx = "TRUE"
return
;************************************************
; Send user info
; Uses variables:
; $msgfile - file user info is in
SendUserInfo:
readvar $msgfile
set $docmd = "U RES\n"
gosub DoCommand
wait "--7-"
send "^KC"
ascsend $Path$msgfile
send "\w^Z"
wait "Command"
set $done = "TRUE"
set $doctrlx = "TRUE"
return
;************************************************
; Set up BBS configuration
ConfigureBBS:
set $docmd = "U TE ANSI\n"
gosub DoCommand
set $docmd = "COL\n"
set $cfgset = $UseColors
gosub CfgEnable
set $docmd = "ED FSE\n"
gosub DoCommand
set $docmd = "REV\n"
set $cfgset = "y"
gosub CfgEnable
set $docmd = "T Z\n"
gosub DoCommand
set $docmd = "AF L\n"
gosub DoCommand
set $docmd = "U A\n"
gosub DoCommand
converse "street address" "^Z"$UserStreet"\n"
converse "code and state" "^Z"$UserAddress"\n"
if $UserPhone == "" then set $UserPhone = "-"
converse "your phone number" "^Z"$UserPhone"\n"
converse "date of birth" "\n"
set $docmd = "R MODE Mark\n"
gosub DoCommand
wait "Command"
set $done = "TRUE"
set $doctrlx = "TRUE"
return
CfgEnable:
set $scfenabled = "n"
when "enabled" set $scfenabled = "y"
gosub DoCommand
wait "Command"
dlwhen
set $doctrlx = "TRUE"
if !$scfenabled == $cfgset then gosub DoCommand
return
;************************************************
; Set the autologoff flag.
; Uses variables:
; $boolean - Logoff (y/n)
AutoLogOff:
readvar $boolean
set $AutoLogoff = "y"
if $boolean == "0" then set $AutoLogoff = "n"
set $done = "TRUE"
return